home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / UCRASM25.ARJ / STRCATL.ASM < prev    next >
Assembly Source File  |  1991-10-12  |  1KB  |  65 lines

  1. StdGrp        group    stdlib,stddata
  2. stddata        segment    para public 'sldata'
  3. stddata        ends
  4. ;
  5. stdlib        segment    para public 'slcode'
  6.         assume    cs:stdgrp
  7. ;
  8. ;
  9. ; strcatl- Appends one string to the end of another.
  10. ;
  11. ; inputs:
  12. ;
  13. ;    ES:DI-  Points at destination string, the one to which the follow
  14. ;            string will be appended.
  15. ;
  16. ;    CS:RET    Points at the follow string.
  17. ;
  18. ;
  19. ; Note: The destination string's (ES:DI) buffer must be sufficiently large
  20. ;    to hold the result of the concatentation of the two strings.
  21. ;
  22.         public    sl_strcatl
  23. ;
  24. sl_strcatl    proc    far
  25.         push    bp
  26.         mov    bp, sp
  27.         push    ds
  28.         push    cx
  29.         push    ax
  30.         pushf
  31.         push    si
  32.         push    di
  33. ;
  34.         cld
  35. ;
  36. ; Find the end of the destination string:
  37. ;
  38.         mov    al, 0
  39.         mov    cx, 0ffffh
  40.     repne    scasb
  41. ;
  42. ; Copy the second string to the end of the current string.
  43. ;
  44.         lds    si, 2[bp]        ;Get Return Address
  45.         dec    di
  46. CpyLp:        lodsb
  47.         stosb
  48.         cmp    al, 0
  49.         jnz    CpyLp
  50. ;
  51.         mov    2[bp], si        ;Save new return address.
  52.         pop    di
  53.         pop    si
  54.         popf
  55.         pop    ax
  56.         pop    cx
  57.         pop    ds
  58.         pop    bp
  59.         ret
  60. sl_strcatl    endp
  61. ;
  62. ;
  63. stdlib        ends
  64.         end
  65.